package com.ssy.lingxi.marketing.model.constant;

import java.util.Arrays;

/**
 * 赠品类型：1-赠商品 2-赠优惠卷
 * @author ds
 * @date 2021/6/18
 * @version 2.0.0
 */
public enum GiveGiftTypeEnum {

    GOODS(1, "赠商品"),
    COUPON(2, "赠优惠卷"),
    ;

    private final Integer code;
    private final String message;

    GiveGiftTypeEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public static String getMessage(Integer code) {
        return Arrays.stream(GiveGiftTypeEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().map(GiveGiftTypeEnum::getMessage).orElse("");
    }


}
